package com.ruoyi.project.wceimms.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.wceimms.domain.WceimmsIrfDetail;
import com.ruoyi.project.wceimms.service.IWceimmsIrfDetailService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 装置送检接收单明细（Inspection Receipt Form）Controller
 * 
 * @author hanl
 * @date 2025-02-06
 */
@RestController
@RequestMapping("/wceimms/detail")
public class WceimmsIrfDetailController extends BaseController
{
    @Autowired
    private IWceimmsIrfDetailService wceimmsIrfDetailService;

    /**
     * 查询装置送检接收单明细（Inspection Receipt Form）列表
     */
    @PreAuthorize("@ss.hasPermi('wceimms:detail:list')")
    @GetMapping("/list")
    public TableDataInfo list(WceimmsIrfDetail wceimmsIrfDetail)
    {
        startPage();
        List<WceimmsIrfDetail> list = wceimmsIrfDetailService.selectWceimmsIrfDetailList(wceimmsIrfDetail);
        return getDataTable(list);
    }

    /**
     * 导出装置送检接收单明细（Inspection Receipt Form）列表
     */
    @PreAuthorize("@ss.hasPermi('wceimms:detail:export')")
    @Log(title = "装置送检接收单明细（Inspection Receipt Form）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WceimmsIrfDetail wceimmsIrfDetail)
    {
        List<WceimmsIrfDetail> list = wceimmsIrfDetailService.selectWceimmsIrfDetailList(wceimmsIrfDetail);
        ExcelUtil<WceimmsIrfDetail> util = new ExcelUtil<WceimmsIrfDetail>(WceimmsIrfDetail.class);
        util.exportExcel(response, list, "装置送检接收单明细（Inspection Receipt Form）数据");
    }

    /**
     * 获取装置送检接收单明细（Inspection Receipt Form）详细信息
     */
    @PreAuthorize("@ss.hasPermi('wceimms:detail:query')")
    @GetMapping(value = "/{irfDetailId}")
    public AjaxResult getInfo(@PathVariable("irfDetailId") Long irfDetailId)
    {
        return success(wceimmsIrfDetailService.selectWceimmsIrfDetailByIrfDetailId(irfDetailId));
    }

    /**
     * 新增装置送检接收单明细（Inspection Receipt Form）
     */
    @PreAuthorize("@ss.hasPermi('wceimms:detail:add')")
    @Log(title = "装置送检接收单明细（Inspection Receipt Form）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WceimmsIrfDetail wceimmsIrfDetail)
    {
        return toAjax(wceimmsIrfDetailService.insertWceimmsIrfDetail(wceimmsIrfDetail));
    }

    /**
     * 修改装置送检接收单明细（Inspection Receipt Form）
     */
    @PreAuthorize("@ss.hasPermi('wceimms:detail:edit')")
    @Log(title = "装置送检接收单明细（Inspection Receipt Form）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WceimmsIrfDetail wceimmsIrfDetail)
    {
        return toAjax(wceimmsIrfDetailService.updateWceimmsIrfDetail(wceimmsIrfDetail));
    }

    /**
     * 删除装置送检接收单明细（Inspection Receipt Form）
     */
    @PreAuthorize("@ss.hasPermi('wceimms:detail:remove')")
    @Log(title = "装置送检接收单明细（Inspection Receipt Form）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{irfDetailIds}")
    public AjaxResult remove(@PathVariable Long[] irfDetailIds)
    {
        return toAjax(wceimmsIrfDetailService.deleteWceimmsIrfDetailByIrfDetailIds(irfDetailIds));
    }
}
